<?php
/**
 * Created by PhpStorm.
 * User: Akon
 * Date: 2016/11/29 0029
 * Time: 22:49
 */
namespace Manager\Controller;
use Think\Controller;

class BaseController extends Controller{
    /**构造函数**/
    public function __construct(){
        //避免覆盖父级的方法
        parent::__construct();
    }

    /**初始化操作**/
    public function _initialize(){
        //_initialize()非php中的函数，thinkphp内置，相当于__construct();
        //session判断，阻止未登录状态访问后台
        if(session('admin_id') <= 0 || !session('admin_id')){
            $this->error('请先登录',U('Manager/Admin/login'));
        }
    }
}